package com.simpleframe.validator.validators;

import com.simpleframe.validator.FieldValidator;

public class RequiredValidator extends FieldValidator {
	
	@Override
	public void validate(Object object) {
		String fieldName = getFieldName();
		Object fieldValue = getFieldValue();
		System.out.println("验证是否为空：" + fieldName+"，值："+fieldValue);
		if(fieldValue!=null){
			String value = (String)fieldValue;
			if(value.length()<=0){
				addFieldError(fieldName,label+"不能为空");
			}
		}else{
			addFieldError(fieldName,label+"不能为空");
		}
	}
	
}
